/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import model.entities.Bill;
import model.entities.RoomStatus;

/**
 *
 * @author Hieu.Nguyen
 */
public class BillDAO {
    private static BillDAO billDAO;

    public static BillDAO getInstance() {
        if (billDAO == null) {
            billDAO = new BillDAO();
        }
        return billDAO;
    }
    
     public List<Bill> getBill(boolean isActived) {
        List<Bill> listBill = new ArrayList<Bill>();
        try {
            Connection conn = ConnectionFactory.getConnection();
            String sql = "select * from tblBill";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            
            ResultSet rs = pstmt.executeQuery();
            while (rs.next()) {
                Bill r = new Bill();
                r.setBillID(rs.getInt("BillID"));
                r.setReservationID(rs.getInt("ReservationID"));
                r.setComments(rs.getString("Comments"));
                listBill.add(r);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return listBill;
    }
    
}
